package o;

import com.google.gson.annotations.JsonAdapter;

public final class aud implements ats {
    private final atv ˊ;

    public aud(atv o_atv) {
        this.ˊ = o_atv;
    }

    public <T> ato<T> ˎ(atb o_atb, auv<T> o_auv_T) {
        JsonAdapter jsonAdapter = (JsonAdapter) o_auv_T.ˋ().getAnnotation(JsonAdapter.class);
        if (jsonAdapter == null) {
            return null;
        }
        return ˏ(this.ˊ, o_atb, o_auv_T, jsonAdapter);
    }

    ato<?> ˏ(atv o_atv, atb o_atb, auv<?> o_auv_, JsonAdapter jsonAdapter) {
        ato<?> o_ato_;
        Object ˋ = o_atv.ˎ(auv.ˋ(jsonAdapter.value())).ˋ();
        if (ˋ instanceof ato) {
            o_ato_ = (ato) ˋ;
        } else if (ˋ instanceof ats) {
            o_ato_ = ((ats) ˋ).ˎ(o_atb, o_auv_);
        } else if ((ˋ instanceof atn) || (ˋ instanceof atf)) {
            atf o_atf;
            atn o_atn = ˋ instanceof atn ? (atn) ˋ : null;
            if (ˋ instanceof atf) {
                o_atf = (atf) ˋ;
            } else {
                o_atf = null;
            }
            o_ato_ = new auq(o_atn, o_atf, o_atb, o_auv_, null);
        } else {
            throw new IllegalArgumentException("Invalid attempt to bind an instance of " + ˋ.getClass().getName() + " as a @JsonAdapter for " + o_auv_.toString() + ". @JsonAdapter value must be a TypeAdapter, TypeAdapterFactory, JsonSerializer or JsonDeserializer.");
        }
        if (o_ato_ == null || !jsonAdapter.nullSafe()) {
            return o_ato_;
        }
        return o_ato_.ˋ();
    }
}
